/**
 *  Copyright (C) 2008-2013  Telosys project org. ( http://www.telosys.org/ )
 *
 *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *          http://www.gnu.org/licenses/lgpl.html
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.telosys.persistence.metadata;

/**
 * POJO for storage of MetaData about Tables of a database
 * 
 * NB : For future use (not yet qualified)
 * 
 * @author Olivier Laurendeau 
 * 
 */
public class DbTable {
	
	private String _sTableCatalog; //May be null
	private String _sTableSchema; //May be null
	private String _sTableName;
	
	// Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
	//"LOCAL TEMPORARY", "ALIAS", "SYNONYM".
	private String _sTableType; 
	private String _sRemarks;
	private String _sTypeCatalog; //May be null
	private String _sTypeSchema; //May be null
	private String _sTypeName; //May be null
	
	//Name of the designated "identifier" column of a typed table
	private String _sSelfReferencingColName; //May be null
	
	//Specifies how values in SELF_REFERENCING_COL_NAME are created.
	//Values are "SYSTEM", "USER", "DERIVED"
	private String _sRefGeneration; //May be null
	
	public DbTable(String tableCatalog, String tableSchema, String tableName,
			String tableType, String remarks, String typeCatalog,
			String typeSchema, String typeName, String selfReferencingColName,
			String refGeneration) {
		super();
		_sTableCatalog = tableCatalog;
		_sTableSchema = tableSchema;
		_sTableName = tableName;
		_sTableType = tableType;
		_sRemarks = remarks;
		_sTypeCatalog = typeCatalog;
		_sTypeSchema = typeSchema;
		_sTypeName = typeName;
		_sSelfReferencingColName = selfReferencingColName;
		_sRefGeneration = refGeneration;
	}

	public DbTable() {	
		new DbTable(null,null,null,null,null,null,null,null,null,null);
	}

	
	
	/**
	 * May be null.
	 * @return String
	 */
	public String getTableCatalog() {
		return _sTableCatalog;
	}

	/**
	 * May be null.
	 * @param tableCatalog
	 */
	void setTableCatalog(String tableCatalog) {
		_sTableCatalog = tableCatalog;
	}

	/**
	 * May be null.
	 * @return String
	 */
	public String getTableSchema() {
		return _sTableSchema;
	}

	/**
	 * May be null.
	 * @param tableSchema
	 */
	void setTableSchema(String tableSchema) {
		_sTableSchema = tableSchema;
	}

	public String getTableName() {
		return _sTableName;
	}

	void setTableName(String tableName) {
		_sTableName = tableName;
	}

	/**
	 * Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
	 * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
	 * @return String
	 */
	public String getTableType() {
		return _sTableType;
	}

	/**
	 * Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
	 * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
	 * @param tableType
	 */
	void setTableType(String tableType) {
		_sTableType = tableType;
	}

	/**
	 * Comment describing table
	 * May be null
	 * @return String
	 */
	public String getRemarks() {
		return _sRemarks;
	}

	/**
	 * Comment describing table
	 * May be null
	 * @param remarks
	 */
	void setRemarks(String remarks) {
		_sRemarks = remarks;
	}

	/**
	 * May be null.
	 * @return String
	 */
	public String getTypeCatalog() {
		return _sTypeCatalog;
	}
	
	/**
	 * May be null.
	 * @param typeCatalog
	 */
	void setTypeCatalog(String typeCatalog) {
		_sTypeCatalog = typeCatalog;
	}

	/**
	 * May be null.
	 * @return String
	 */
	public String getTypeSchema() {
		return _sTypeSchema;
	}

	/**
	 * May be null.
	 * @param typeSchema
	 */
	void setTypeSchema(String typeSchema) {
		_sTypeSchema = typeSchema;
	}

	/**
	 * May be null.
	 * @return String
	 */
	public String getTypeName() {
		return _sTypeName;
	}

	/**
	 * May be null.
	 * @param typeName
	 */
	void setTypeName(String typeName) {
		_sTypeName = typeName;
	}

	/**
	 * Name of the designated "identifier" column of a typed table
	 * May be null
	 * @return String
	 */
	public String getSelfReferencingColName() {
		return _sSelfReferencingColName;
	}

	/**
	 * Name of the designated "identifier" column of a typed table
	 * May be null
	 * @param selfReferencingColName
	 */
	void setSelfReferencingColName(String selfReferencingColName) {
		_sSelfReferencingColName = selfReferencingColName;
	}

	/**
	 * Specifies how values in SELF_REFERENCING_COL_NAME are created.
	 * Values are "SYSTEM", "USER", "DERIVED"
	 * May be null
	 * @return String
	 */
	public String getRefGeneration() {
		return _sRefGeneration;
	}

	/**
	 * Specifies how values in SELF_REFERENCING_COL_NAME are created.
	 * Values are "SYSTEM", "USER", "DERIVED"
	 * May be null
	 * @param refGeneration
	 */
	void setRefGeneration(String refGeneration) {
		_sRefGeneration = refGeneration;
	}

	public String toString() {
		return _sTableCatalog+"|"+_sTableSchema+"|"+_sTableName+"|"+_sTableType+"|"+_sRemarks+"|"+
			_sTypeCatalog+"|"+_sTypeSchema+"|"+_sTypeName+"|"+_sSelfReferencingColName+"|"+_sRefGeneration;
	}
	
}
